Target net8.0 as minimum TFM for NuGet package#118
Merged
Conversation
The generated code uses ARM SIMD VectorTableLookup tuple overloads (and other APIs) that require net8.0+. The previous netstandard2.0 target was misleading since consumers on older frameworks would get compile errors from the generated code. - Change SortingNetworks (NuGet package) from netstandard2.0 to net8.0 - Change Directory.Build.props default from net10.0 to net8.0 - Remove redundant TFM override from sample project The generator project stays at netstandard2.0 (Roslyn requirement). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the repository and packaged library to treat .NET 8 as the new baseline, aiming to align NuGet/package metadata with the generated code’s actual runtime/API requirements.
Changes:
- Retargets the
SortingNetworks.SourceGenpackage project fromnetstandard2.0tonet8.0. - Lowers the repo-wide default TFM from
net10.0tonet8.0, so tests/benchmarks validate against the proposed minimum. - Removes the sample’s explicit TFM override and adds
RollForward=Majorto the test project.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| SortingNetworks/SortingNetworks.csproj | Changes the packaged library target framework to net8.0. |
| SortingNetworks.Tests/SortingNetworks.Tests.csproj | Adds runtime roll-forward for the test app. |
| samples/SortingNetworks.Sample/SortingNetworks.Sample.csproj | Removes the sample’s explicit net10.0 target so it inherits the repo default. |
| Directory.Build.props | Changes the repo-wide default target framework from net10.0 to net8.0. |
Benchmarks should run on the latest runtime for accurate perf numbers. Only the NuGet package, tests, and sample explicitly target net8.0 to validate the minimum supported TFM. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
RestoreSources replaces all NuGet sources, preventing the net8.0 runtime host pack from being downloaded from nuget.org. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
69ea136 to
366317a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The NuGet package (
SortingNetworks.SourceGen) previously targetednetstandard2.0, which made the NuGet page show compatibility with .NET Framework 4.6.1+, .NET Core 2.0+, etc. In practice, the generated code won't compile on anything below net8.0 because it uses APIs introduced in that release (ARM SIMDVectorTableLookuptuple overloads,Vector128.ConditionalSelect,StoreUnsafe).This PR updates the package TFM to
net8.0so NuGet correctly communicates the real minimum to consumers.How the minimum was determined:
Built a test project with
[SortingNetwork(27, typeof(int))]against progressively lower TFMs:Vector128.ConditionalSelect,StoreUnsafe(175 errors)VectorTableLookuptuple overloads for ARM multi-register intrinsics (65 errors)Changes:
SortingNetworks.csproj:netstandard2.0->net8.0(the NuGet package DLL)Directory.Build.props:net10.0->net8.0(tests + benchmarks now validate against the minimum)net8.0fromDirectory.Build.props)<RollForward>Major</RollForward>so tests run on newer runtimes (e.g. 9.0/10.0)The generator project stays at
netstandard2.0-- that's a Roslyn requirement for source generators.